#include "levelpropertiesdlg.h"
#include "levelObjects/level.h"
#include "document.h"
#include "application.h"

LevelPropertiesDlg::LevelPropertiesDlg( QPointer<LevelObjects::Level> level /*= QPointer<LevelObjects::Level>()*/,
	QWidget *parent /*= 0*/ )
	: QDialog(parent)
	, m_level(level)
{
	ui.setupUi(this);
	connect(ui.pushButtonOK, &QPushButton::clicked, this, &LevelPropertiesDlg::onOK);
}

void LevelPropertiesDlg::onOK()
{
	ACQUIRE_DOC();
	if(!m_level)
	{
		doc->createLevel(ui.lineEditLevelName->text());
	}
	
	accept();
}
